# 贪心算法 跳跃游戏

class Solution:

    def canJump(self, nums):
        k = 0 # 可以到达最远的距离
        for i in range(len(nums)):

            if i > k:
                return False

            k = max(k, i + nums[i])


        return True
    

if __name__ == "__main__":

    nums = [2,3,1,1,4]
    sol = Solution()
    res = sol.canJump(nums)
    print(res)





